package com.example.fasttalk.window;

import com.example.fasttalk.model.FastTalkRecordModel;

import java.awt.*;
import java.text.SimpleDateFormat;

import javax.swing.*;

public class FastTalkRecordViewWindow extends JPanel {
  private FastTalkRecordModel fastTalkRecordModel;
  private JLabel talkRecordHeader;
  private JLabel talkRecordText;

  FastTalkRecordViewWindow(FastTalkRecordModel fastTalkRecordModel) {
    this.fastTalkRecordModel = fastTalkRecordModel;
    SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd-HH:mm:ss");
    talkRecordHeader = new JLabel(String.format("%s : %s", fastTalkRecordModel.getSendUser().getUserName(), format.format(fastTalkRecordModel.getSendDate())));
    talkRecordText = new JLabel(fastTalkRecordModel.getSendText());

    GridLayout gridLayout = new GridLayout(2, 1, 5, 5);
    setLayout(gridLayout);
    add(talkRecordHeader);
    add(talkRecordText);
    setBorder(BorderFactory.createLoweredBevelBorder());
  }
}
